package com.example.lpcommon;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.example.lpcommon.thread.ThreadActivity;

public class CommonActivity extends AppCompatActivity implements View.OnClickListener {
    private static String TAG="ThreadActivity";
    private Button btn_thread;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_common);
        initView();
    }

    private void initView() {
        btn_thread = findViewById(R.id.btn_thread);
        btn_thread.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Log.i(TAG, "onClick: ");
        //在模块中只能使用if来代替switch，因为id的值问题
        if (v.getId() == R.id.btn_thread) {
            Log.i(TAG, "前往Thread模块: ");
            startActivity(new Intent(this, ThreadActivity.class));
        }

    }
}
